# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=edbrowse
pkgver=3.8.8
pkgrel=0
pkgdesc="Line-oriented editor, web browser, and mail client"
url="https://edbrowse.org/"
arch="all !s390x !ppc64le" # quickjs
license="GPL-2.0-or-later"
makedepends="
	curl-dev
	openssl-dev
	pcre2-dev
	perl
	quickjs-dev
	readline-dev
	unixodbc-dev
	"
subpackages="$pkgname-doc"
source="https://github.com/CMB/edbrowse/archive/v$pkgver/edbrowse-$pkgver.tar.gz
	quickjs-shared.patch
	"

prepare() {
	default_prepare

	# "edbrowse -v" in check() fails if ~/.ebrc is not found
	if want_check; then
		touch "$srcdir"/.ebrc
	fi
}

build() {
	make
}

check() {
	HOME="$srcdir" ./src/edbrowse -v
}

package() {
	make DESTDIR="$pkgdir" PREFIX=/usr -C src install

	install -Dvm644 doc/man-edbrowse-debian.1 \
		"$pkgdir"/usr/share/man/man1/edbrowse.1
	install -Dvm644 doc/sample.ebrc README \
		-t "$pkgdir"/usr/share/doc/$pkgname/
	install -Dvm644 COPYING \
		-t "$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
7d11786655415a5e2bbc6a1249b26a61b7493ec44dbf034dd2b632dc965cd05a2703ac465dd454240c68176fb48ea2b020893e3ecf1ba04b7f30594a915b9186  edbrowse-3.8.8.tar.gz
367ed382d7e49fd49d00124c4215892f0fa56db82cffd78fe798f020354b5af3f765ba700310992e236034b1610a179543fb57e9823c45caeecfd2216b7fc6d0  quickjs-shared.patch
"
